package com.naire.modul.contract.action;

import java.util.ArrayList;
import java.util.List;

import net.common.action.GeneralAction;
import com.naire.modul.contract.service.ContractDeleteService;
import com.naire.modul.contract.service.ContractEditorService;
import com.naire.modul.contract.service.ContractFindService;
import com.naire.modul.contract.service.ContractSearchService;
import com.naire.modul.contract.vo.ContractVo;

public class ContractAction extends GeneralAction {

	private static final long serialVersionUID = 7127573666355745443L;

	private ContractVo bean = new ContractVo();
	private List<ContractVo> list = new ArrayList<ContractVo>();
	
	public String search() throws Exception {
		ContractSearchService service = new ContractSearchService();
		service.setPageBean(pageBean);
		service.invoke();
		list = service.getList();
		return SUCCESS;
	}
	
	public String editor() throws Exception {
		ContractEditorService service = new ContractEditorService();
		service.setBean(bean);
		service.invoke();
		return SUCCESS;
	}
	
	public String find() throws Exception {
		if(bean.getContract_id() != null) {			
			ContractFindService service = new ContractFindService();
			service.setId(bean.getContract_id());
			service.invoke();
			bean = service.getBean();
		}
		return SUCCESS;
	}
	
	public String delete() throws Exception {
		ContractDeleteService service = new ContractDeleteService();
		service.setBean(bean);
		service.invoke();
		return SUCCESS;
	}
	
	public ContractVo getBean() {
		return bean;
	}
	public void setBean(ContractVo bean) {
		this.bean = bean;
	}
	public List<ContractVo> getList() {
		return list;
	}
	public void setList(List<ContractVo> list) {
		this.list = list;
	}
}
